package com.niiwoo.civet.trade.service.dubbo.newRefund;

import com.alibaba.dubbo.config.annotation.Service;
import com.niiwoo.civet.base.enums.RefundTypeEnum;
import com.niiwoo.civet.trade.dto.newRefund.RefundStateDTO;
import com.niiwoo.civet.trade.dto.response.newRefund.RefundCalculateDTO;
import com.niiwoo.civet.trade.service.local.newRefund.refundDeal.core.FeeCalcForRefundService;
import com.niiwoo.civet.trade.service.newRefund.FeeCalcForRefundDubboService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by yuanguang on 2018/5/21.
 */
@Service(version = "1.0.0")
public class FeeCalcForRefundDubboServiceImpl implements FeeCalcForRefundDubboService {
    @Autowired
    private FeeCalcForRefundService feeCalcForRefundService;
    /**
     * 获取应还金额
     * @param projectId
     * @param refundTypeEnum
     * @return
     */
    public RefundCalculateDTO caculateAmountRepaymentForAPP(Long projectId, RefundTypeEnum refundTypeEnum){
        RefundCalculateDTO refundCalculateDTO = new RefundCalculateDTO();
        RefundStateDTO refundStateDTO =feeCalcForRefundService.caculateAmountRepaymentForAPP(projectId,refundTypeEnum);
        BeanUtils.copyProperties(refundStateDTO,refundCalculateDTO);
        return refundCalculateDTO;
    }

    /**
     * 获取应还金额
     * 已处理利息
     * @param projectId
     * @param periods
     * @return
     */
    public RefundCalculateDTO caculateAmountByPeriods(Long projectId, List<Integer> periods){
        RefundCalculateDTO refundCalculateDTO = new RefundCalculateDTO();
        RefundStateDTO refundStateDTO =feeCalcForRefundService.caculateAmountByPeriods(projectId,periods);
        BeanUtils.copyProperties(refundStateDTO,refundCalculateDTO);
        return refundCalculateDTO;
    }
}
